import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
import { CommonEntity } from '~/common/entity/common.entity';
import { ArticleContentEntity } from '../article-content.entity';
import { UserEntity } from '~/modules/user/user.entity';

@Entity({ name: 'ah_article_content_share' })
@Index(['id'])
export class ArticleContentShareEntity extends CommonEntity {
	@ManyToOne(() => ArticleContentEntity, (content) => content.contentLikes)
	@JoinColumn({ name: 'content_id' })
	content: ArticleContentEntity;

	@ManyToOne(() => UserEntity, (user) => user.contentLikes)
	@JoinColumn({ name: 'user_id' })
	user: UserEntity;

	// 备注
	@Column({ type: 'text', comment: '备注', nullable: true })
	remark: string;
}
